package com.zzx.threekingdom.card;

public class Pattern
{
    public enum Color
    {
        spade, heart, club, diamond, NA;
    }
    
    public enum Points
    {
        ace, two, three, four, five, six, seven, eight, nine, ten, jack, queen, king, NA;
    }
    
    public Color color;
    public Points points;
    
    public final static String SPADE = "♠";
    public final static String HEART = "♥";
    public final static String CLUB = "♣";
    public final static String DIAMOND = "♦";
    
    public Pattern(Color c, Points p)
    {
        color = c;
        points = p;
    }
    
    public Color getColor() { return color; }
    public Points getPoints() { return points; }
    public boolean isRed() { return ((color==Color.heart)||(color==Color.diamond)); }
    public String getPointsString() { return points2String(points); }
    public int getPointsInt() { return points2Int(points); }
    
    public String getColorString()
    {
        switch(color)
        {
            case spade:
                return SPADE;
            case heart:
                return HEART;
            case club:
                return CLUB;
            case diamond:
                return DIAMOND;
        }
        return "";
    }
    
    public static String points2String(Points points)
    {
        switch(points)
        {
            case ace:
                return "1";
            case two:
                return "2";
            case three:
                return "3";
            case four:
                return "4";
            case five:
                return "5";
            case six:
                return "6";
            case seven:
                return "7";
            case eight:
                return "8";
            case nine:
                return "9";
            case ten:
                return "10";
            case jack:
                return "J";
            case queen:
                return "Q";
            case king:
                return "K";
        }
        return "";
    }
    
    public static int points2Int(Points points)
    {
        switch(points)
        {
            case ace:
                return 1;
            case two:
                return 2;
            case three:
                return 3;
            case four:
                return 4;
            case five:
                return 5;
            case six:
                return 6;
            case seven:
                return 7;
            case eight:
                return 8;
            case nine:
                return 9;
            case ten:
                return 10;
            case jack:
                return 11;
            case queen:
                return 12;
            case king:
                return 13;
        }
        return 0;
    }
    
    


}
